 <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>请登陆系统</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />    
    

    <link href="modules/resources/css/login/bootstrap.min.css" rel="stylesheet">
    <link href="modules/resources/css/login/adminia.css" rel="stylesheet">
    <link href="modules/resources/css/login/login.css" rel="stylesheet">
<!--    <script type="text/javascript" src="common/all.js"></script> -->

	<script type="text/javascript" src="common/jquery/jquery-1.12.3.js"></script>
	<script src="common/sys.js"></script>
<!-- 	<script src="common/bootstrap/js/bootstrap.js"></script> -->

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
	

<body>
	
<div class="navbar navbar-fixed-top">
	
	<div class="navbar-inner">
		
		<div class="container">
			
			<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span> 				
			</a>
			
			<a class="brand" href="./">欢迎使用Admin管理系统</a>
			
			<div class="nav-collapse">
			
				<ul class="nav pull-right">
					
					<li class="">
						
						<a href="javascript:;"><i class="icon-chevron-left"></i> 使用说明</a>
					</li>
				</ul>
				
			</div> <!-- /nav-collapse -->
			
		</div> <!-- /container -->
		
	</div> <!-- /navbar-inner -->
	
</div> <!-- /navbar -->


<div id="login-container">
	
	
	<div id="login-header">
		
		<h3>Login</h3>
		
	</div> <!-- /login-header -->
	
	<div id="login-content" class="clearfix">
	
	<form action="./" />
				<fieldset>
					<div class="control-group">
						<label class="control-label" for="username">登录名</label>
						<div class="controls">
							<input type="text" class="" id=_username />
							<span id="_username_sapn" style="color: red;"></span>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="password">密码</label>
						<div class="controls">
							<input type="password" class="" id="_password" />
							<span id="_password_sapn" style="color: red;"></span>
							
						</div>
					</div>
				</fieldset>
				
				

    
				
				<div id="remember-me" class="pull-left">
					<input type="checkbox" name="remember" id="_rememberme" />
					<label id="remember-label" for="remember">记往登录</label>
				</div>
				
				<br/><br/>
				<div class="control-group" id="_captcha_div" style="display: none;">
					 <label id="control-label" for="captcha"><span id="captcha_sapn" style="color: red;">请输入验证码：</span></label>
					 <input  type="text" name="captcha" id="_captchaCode" style="width: 100px"/>  
				    <img  class="jcaptcha-btn jcaptcha-img" id="_captchaCode_img" src="/jcaptcha.jpg" onclick="this.src='/jcaptcha.jpg?d='+new Date()*1" title="点击更换验证码"/>  
				</div>

				<div class="pull-right">
					<button type="button" id="_login" class="btn btn-warning btn-large">
						登录
					</button>
				</div>
			</form>
			
		</div> <!-- /login-content -->
		
		
		<div id="login-extra">
				<p>	Copyright © 2016-2017 v1.2 </p>
<!-- 			<p>Don't have an account? <a href="javascript:;">Sign Up.</a></p> -->
			
<!-- 			<p>Remind Password? <a href="forgot_password.html">Retrieve.</a></p> -->
			
		</div> <!-- /login-extra -->
	
</div> <!-- /login-wrapper -->

    

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->



<script type="text/javascript">


	$(function(){
		initLogin();
		
	})

	function initLogin(){
		var isCaptcha=getUrlParam('isCaptcha');
		//alert(isCaptcha);
		if(isCaptcha=="1"){
			$("#_captcha_div").css("display","block");
		}
		//$("#_captcha_div").css("display","none");
	}

	$("#_login").click(function() {
		var username = $("#_username").val();
		var password = $("#_password").val();
		var rememberme = $("#_rememberme").is(':checked');
		var captcha = $("#_captchaCode").val();
		
		//验证码处理
		var capthcaDisplay=$('#_captcha_div').css('display');
		//alert(capthcaDisplay);
     	if(capthcaDisplay=="block")
     	{
     	   if(captcha==""){
     		   alert("请输入验证码");
     		   return;
     	   }	
     	}
		
		

		
		//alert(rememberme);
		if(username=="")
		{
			$("#_username_sapn").html('请输入用户名');
			return;
		}else
		{
			$("#_username_sapn").html('');
		}
		
		if(password=="")
		{
			$("#_password_sapn").html('请输入密码');
			return;
		}else
		{
			$("#_password_sapn").html('');
		}
		
		
		$.ajax({
			url : getContextPath()+'/login',
			data : {
				'userName' : username,
				'password' : password,
				'rememberMe' : rememberme,
				'captcha':captcha
			},
			type : 'post',
			cache : false,
			dataType : 'json',
			success : function(data,success) {
				//alert(success);
				//alert(JSON.stringify(data));
				
				
				 if(success!="success")
				  {
					   alert("请求系统异常");
				       return ;
				  }
				
				 
				 if(data.success && data.messageCode == "001")
				 {
					 window.location.href = getContextPath()+"/views/main.html";
					 return;
				 }
				 
				
				 if(data.messageCode == "012" || data.messageCode == "013")
				 {    //验证码处理
					 $("#_captcha_div").css("display","block");
					 $('#_captchaCode_img').trigger("click");
					 $("#captcha_sapn").text(data.message);
				     return;
				 }else{
					var iscaptcha= $("#_captcha_div").css("display");
					if("block"==iscaptcha){
						 $('#_captchaCode_img').trigger("click");
					}
					
					 alert(data.message);
				 }

			},
			error : function() {
				alert("异常！");
			}
		});
	});
</script>


  </body>
</html>
 